package com.liws.hellofeiginservice.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.liws.hellocommon.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: liweisheng
 * @Dcscription:
 * @Date: 2021/11/22 10:07
 */

@RestController
@RequestMapping("/feigin")
public class HelloFeiginController {



    @RequestMapping(value = "/product/getFeiginByName",method = RequestMethod.GET)
    public String getFeiginByName(@RequestParam("name") String name){

        return "Get：hello I'm product feigin"+name;
    }


    @RequestMapping(value = "/product/postFeiginByObject",method = RequestMethod.POST)
    public List<Person> postFeiginByObject(@RequestBody Person person){


        List<Person> list=new ArrayList<>();

        list.add(person);

        Person xiaoMing = new Person();
        xiaoMing.setName("xiaoMing");
        xiaoMing.setAge(17);
        xiaoMing.setMoney(100.33);
        xiaoMing.setIsFlag(false);
        list.add(xiaoMing);

        Person xiaoHong = new Person();
        xiaoHong.setName("xiaoHong");
        xiaoHong.setAge(37);
        xiaoHong.setMoney(10.323);
        xiaoHong.setIsFlag(true);
        list.add(xiaoHong);

        return list;

    }

}
